package cn.iocoder.yudao.module.scrm.controller.admin.clue.vo;

import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.module.scrm.annotations.FieldRepeatValidator;
import cn.iocoder.yudao.module.scrm.annotations.FieldRepeatValidators;
import cn.iocoder.yudao.module.scrm.framework.operatelog.core.ScrmClueClientFunction;
import cn.iocoder.yudao.module.scrm.framework.operatelog.core.ScrmClueIdeaFunction;
import cn.iocoder.yudao.module.scrm.framework.operatelog.core.ScrmClueInfoFunction;
import cn.iocoder.yudao.module.scrm.framework.operatelog.core.ScrmClueStateFunction;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mzt.logapi.starter.annotation.DiffLogField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.Date;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
import static cn.iocoder.yudao.module.scrm.enums.DictTypeConstants.*;

@Schema(description = "管理后台 - 线索新增/修改 Request VO")
@Data
@FieldRepeatValidators(tableName = "scrm_clue", idField = "id", fieldRepeatValidators = {@FieldRepeatValidator(field = "phone", property = "phone", message = "手机号码已经存在！")})
public class ClueSaveReqVO {

    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20063")
    private Integer id;

    @DiffLogField(name = "姓名")
    @Schema(description = "姓名", example = "芋艿")
    @NotNull(message = "姓名不能为空")
    private String name;

    @DiffLogField(name = "企业名称")
    @Schema(description = "企业名称")
    private String enterprise;

    @DiffLogField(name = "手机号码")
    @Schema(description = "手机号码")
    private String phone;

    @DiffLogField(name = "线索来源")
    @Schema(description = "线索来源")
    private String clueSource;

    @DiffLogField(name = "获客时间")
    @Schema(description = "获客时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
    @NotNull(message = "获客时间不能为空")
    private LocalDateTime acquisitionTime;

    @DiffLogField(name = "客户来源", function = ScrmClueClientFunction.NAME)
    @DictFormat(SCRM_CLUE_CLIENT)
    @Schema(description = "客户来源  scrm_clue_client")
    private String clientSource;

    @DiffLogField(name = "素材来源")
    @Schema(description = "素材来源")
    private String materialSource;

    @DiffLogField(name = "信息来源", function = ScrmClueInfoFunction.NAME)
    @DictFormat(SCRM_CLUE_INFO)
    @Schema(description = "信息来源 scrm_clue_info")
    private String infoSource;

    @DiffLogField(name = "客户意向", function = ScrmClueIdeaFunction.NAME)
    @DictFormat(SCRM_CLUE_IDEA)
    @Schema(description = "客户意向  scrm_clue_idea")
    private String clientQuality;

    @DiffLogField(name = "备注")
    @Schema(description = "备注", example = "你说的对")
    @Size(message = "备注信息-不能超过1000个字符", max = 1000)
    private String remark;

    @Schema(description = "用户信息_id", example = "8327")
    private String userId;

    @Schema(description = "用户部门_id", example = "25340")
    private String deptId;

    @Schema(description = "线索系统状态 scrm_clue_system_state")
    private String clueSystemState;

    @Schema(description = "线索状态- scrm_clue_state")
    @DiffLogField(name = "线索状态", function = ScrmClueStateFunction.NAME)
    @DictFormat(SCRM_CLUE_STATE)
    private String clueState;

    @Schema(description = "系统编号")
    private String systemNumber;

    @Schema(description = "线索当前所属部门")
    private String clueDepartment;

    @Schema(description = "创建人员")
    private String createBy;

    @Schema(description = "前归属人员")
    private String agoAffiliationBy;

    @Schema(description = "前归属部门")
    private String agoAffiliationDepartment;

    @Schema(description = "最后跟进时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT)
    private Date followUpTime;

    @Schema(description = "线索当前的归属人-")
    private String cluePerson;

    @Schema(description = "附件上传地址", example = "https://www.iocoder.cn")
    private String fileUrl;

    @Schema(description = "默认0新增的数据 1导入的数据")
    private String importCheck;

    @Schema(description = "备用字段")
    private String testV;

    @Schema(description = "是否置顶 0不置顶  1置顶")
    private String topIf;

}